package com.sz.sidi.service.impl;


import java.util.List;

import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.transaction.annotation.Transactional;

import com.sz.sidi.dao.hibernate.BaseHbDao;
import com.sz.sidi.dao.jdbc.BaseJdbcDao;
import com.sz.sidi.entity.TuserInfo;
import com.sz.sidi.exceptions.BusinessException;
import com.sz.sidi.service.IBaseService;
import com.sz.sidi.util.DaoUtil;

public class IBaseServiceimpl implements IBaseService{
	
	
	private BaseHbDao basehbdao;
	private BaseJdbcDao baseJdbcdao;
	
	public BaseHbDao getBasehbdao() {
		return basehbdao;
	}

	public void setBasehbdao(BaseHbDao basehbdao) {
		this.basehbdao = basehbdao;
	}

	public BaseJdbcDao getBaseJdbcdao() {
		return baseJdbcdao;
	}

	public void setBaseJdbcdao(BaseJdbcDao baseJdbcdao) {
		this.baseJdbcdao = baseJdbcdao;
	}

	@Transactional
	public TuserInfo getUserInfo(String fgh) throws BusinessException{
		return baseJdbcdao.getUserInfo(fgh);
	}

	public List<TuserInfo> gethbUserInfo() throws BusinessException {
		return basehbdao.getHbUserInfo();
	}

	public List getEnity(Class clazz, String table, String wheresql,
			String ordrebysql) throws BusinessException {
		List list = null;
		try {
			SqlRowSet rs = baseJdbcdao.getEnity(table, wheresql, ordrebysql);
			list = DaoUtil.convertToList(rs, clazz);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
 
}
